//
// Created by Taseny on 25-4-2.
//

#include "peripheral_init.h"

static void reset_power(uint32_t power_on_delay)
{
    HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15, GPIO_PIN_RESET);      //外设掉电
    HAL_Delay(power_on_delay);
    HAL_GPIO_WritePin(GPIOC, GPIO_PIN_15, GPIO_PIN_SET);        //5V外设供电开启
}

void peripheral_init(void)
{

    reset_power(1000);

    servo_pwm_init();
    bmi270_init();
    motor_init();
    encoder_init();


#if USE_UART2_IT == 1
    HAL_UART_Receive_IT(&huart2, &rx_buffer[rx_buffer_index], 1);
#endif
}